from myauto import MyAuto, wraper
from apps import APPS
from mylog import Log
import sys

log = Log()
def specialmain(device, app_name, tasks=None):
	the_worker = APPS.get(app_name)
	myauto = MyAuto(device)
	
	log.set_name('netcash_speical'+ device, app_name)
	wraper.log = log
	if not tasks:
		tasks = ['签到', '周期', '内容']
	for task in tasks:
		task_control = {app_name: task}
		today_cash = {app_name: {}}
		app = the_worker[0](myauto, log, the_worker[2])
		app_mian = the_worker[1](app, task_control, today_cash)
		app_mian.main()

if __name__ == '__main__':
	args = sys.argv
	try:
		tasks = [i for i in args[3:]]
		specialmain(args[1], args[2], tasks)
	except Exception as e:
		log.info(f'{e}')



